Skip to content

feat: add preview side editor #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

feat: add preview side editor #38

wants to merge 13 commits into from

Conversation

remidej
Copy link

@remidej remidej commented Mar 4, 2025

What does it do?

  • adds the frontend code needed to react to events dispatched from the admin to let our site know that data was updated in Strapi, and therefore we need to refetch the route data
  • updates env variables. The STRAPI_ADMIN prefix from PREVIEW_SECRET and CLIENT_URL environment variables, which are only used for preview. This prefix made the vars available on the frontend, but because preview does the URL generation in the backend, it was not necessary. It would still work without this change but I think launchpad should show best practices.
  • deletes the "PreviewButton" code. This was a custom extension built by Alex for demo purposes before Preview was built natively. Now that preview is available for real, it's not required and could only create confusion
  • ...a bunch of prettier autofixes too unfortunately. I recommend setting up prettier in this repo with Husky so it gets applied on every commit, otherwise we'll keep getting noisy diffs on PRs

Why is it needed?

The goal is to showcase Advanced Preview functionality (only works with a license).

How to test it?

Use a STRAPI_LICENSE with EE or growth plan associated.

Open the preview page for an entry. See the side editor on the left. Make an update with it and save, you should see the changes reflected immediately in the iframe.

Some additional things to check:

  • Strapi project uuid is "LAUNCHPAD". strapi/packages.json.
  • If you updated content, make sure to create a new export in the strapi/data folder and update the strapi/packages.json seed command if necessary.
  • Strapi version is the latest possible.

@remidej remidej marked this pull request as ready for review April 3, 2025 13:56
@remidej remidej requested a review from Mcastres April 3, 2025 13:56
@Mcastres
Copy link
Collaborator

Mcastres commented Apr 4, 2025

Hello @remidej 👋
Thanks for the contribution. Could you fill the description to explain what are your changes?

This would require a review from @Baldinof since it is changing en variables (hosted demo)

@Mcastres Mcastres requested a review from Baldinof April 4, 2025 07:51
Copy link

vercel bot commented Apr 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
launch-pad ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2025 0:03am

@remidej
Copy link
Author

remidej commented Apr 7, 2025

@Mcastres done, the description is updated

@Mcastres
Copy link
Collaborator

Mcastres commented Apr 8, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants